package com.xj.edu.hotel.controller;

import com.xj.edu.hotel.domain.Role;
import com.xj.edu.hotel.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


@Controller
@RequestMapping("role")
public class RoleController {

    @Autowired
    private RoleService roleService;

    /**
     * 查找所有的角色
     * @return
     */
    @RequestMapping("findAllRole")
    @ResponseBody
    public List<Role> findAllRole(){
       return roleService.findAllRoleType();
    }
    /**
     * 通过角色类型查找角色描述
     */
    @RequestMapping("findRoleDescription")
    @ResponseBody
    public Role findRoleDescriptionByRoleType(String roleType){
        return roleService.findRoleDescriptionByRoleType(roleType);
    }
}
